import request from '@/utils/request'
import store from '../store'

export function loginByUsername(data) {
  // const data = {
  //   account: username,
  //   password,
  //   type: 1
  // }
  return request({
    url: '/admin/login/',
    method: 'post',
    data
  })
}

export function logout() {
  return Promise.resolve({})
  // return request({
  //   url: '/logout/',
  //   method: 'post'
  // })
}

export function getUserInfo(token) {
  console.log(store.state.user, '233333')
  console.log(localStorage.getItem('role'), '233232323232232323232333')
  return Promise.resolve({ data: { readerid: localStorage.getItem('readerId'), roles: [localStorage.getItem('role')], avatar: 'https://wpimg.wallstcn.com/f778738c-e4f8-4870-b634-56703b4acafe.gif' }})
  // return request({
  //   url: '/is_login/',
  //   method: 'get',
  //   params: { token }
  // })
}

